package com.dm.saleassback.common.util;

import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class ResultJsonUtil {
    public Map<String,Object> getResultJsonMap(List<Map<String,Object>> list){
        JSONArray Js = JSONArray.fromObject(list);
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("total", list.size());
        jsonObject.put("rows", Js.toString());
        Map<String,Object> tempMap = new HashMap<String, Object>();
        tempMap.put("serviceList",jsonObject);
        return tempMap;
    }
}
